﻿<navigation:Page x:Class="Corina.Lantern.Hub.Views.Datas.SpecimenView"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:be="clr-namespace:Corina.Interactivity.Silverlight;assembly=Corina.Interactivity.Silverlight"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                 xmlns:localViewmodel="clr-namespace:Corina.Lantern.Hub.Viewmodels"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                 xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                 xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                 Title="SpecimenView Page"
                 FontSize="14"
                 d:DesignHeight="480"
                 d:DesignWidth="900"
                 mc:Ignorable="d">
    <navigation:Page.DataContext>
        <localViewmodel:SpecimenViewmodel />
    </navigation:Page.DataContext>

    <navigation:Page.Resources>
        <Style x:Key="style_labeltest" TargetType="TextBlock">
            <Setter Property="Foreground" Value="{StaticResource NormalFontBrush}" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
    </navigation:Page.Resources>
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <toolkit:Expander Header="{StaticResource IDS_SPECIMEN_ADD_PANELHEADER}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBlock Style="{StaticResource style_labeltest}" Text="{StaticResource IDS_SPECIMEN_ADD_DEVICESN}" />
                <sdk:AutoCompleteBox Grid.Column="1"
                                     ItemsSource="{Binding DeviceCollection}"
                                     MinimumPrefixLength="0"
                                     SelectedItem="{Binding SelectedDevice,
                                                            Mode=TwoWay}"
                                     ValueMemberPath="DeviceSn"
                                     be:AutoCompleteBoxHelper.OtherPaths="Kind,DeviceSn">
                    <sdk:AutoCompleteBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock>
                                <Run Text="{Binding DeviceSn, Mode=OneWay}" />
                                <LineBreak />
                                <Run FontSize="10" Text="{Binding Kind, Mode=OneWay}" />
                            </TextBlock>
                        </DataTemplate>
                    </sdk:AutoCompleteBox.ItemTemplate>
                </sdk:AutoCompleteBox>
                <TextBlock Grid.Column="2"
                           Margin="12,0,0,0"
                           Style="{StaticResource style_labeltest}"
                           Text="{StaticResource IDS_SPECIMEN_ADD_CODE}" />
                <TextBox Grid.Column="3" Text="{Binding Code, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                <TextBlock Grid.Column="4"
                           Margin="12,0,0,0"
                           Style="{StaticResource style_labeltest}"
                           Text="{StaticResource IDS_SPECIMEN_ADD_NAME}" />
                <TextBox Grid.Column="5" Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                <Button Grid.Column="6"
                        Margin="12,0,0,0"
                        Command="{Binding SubmitCommand}"
                        Content="{StaticResource IDS_SPECIMEN_ADD_SUBMIT}" />
            </Grid>
        </toolkit:Expander>

        <toolkit:BusyIndicator Grid.Row="1"
                               Margin="0,12"
                               BusyContent="{StaticResource IDS_COMMON_BUSYCONTENT_LOADING}"
                               IsBusy="{Binding IsBusy}">
            <sdk:DataGrid AutoGenerateColumns="False"
                          ColumnWidth="*"
                          ItemsSource="{Binding ItemsCollection}">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Binding="{Binding ItemIndex}" Header="{StaticResource IDS_SPECIMEN_DATA_ROWNUMBER}" />
                    <sdk:DataGridTextColumn Binding="{Binding Code}" Header="{StaticResource IDS_SPECIMEN_DATA_CODE}" />
                    <sdk:DataGridTextColumn Binding="{Binding Name}" Header="{StaticResource IDS_SPECIMEN_DATA_NAME}" />
                    <sdk:DataGridTextColumn Binding="{Binding DeviceSn}" Header="{StaticResource IDS_SPECIMEN_DATA_DEVICESN}" />
                    <sdk:DataGridTextColumn Binding="{Binding Kind}" Header="{StaticResource IDS_SPECIMEN_DATA_KIND}" />
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
        </toolkit:BusyIndicator>
    </Grid>
</navigation:Page>
